package com.imy.lua.view.console;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.imy.common.base.adapter.BaseSimpleListAdapter;
import com.imy.common.base.adapter.BaseViewHolder;
import com.imy.lua.R;

import java.util.List;

public class ConsoleAdapter  extends BaseSimpleListAdapter<String, ConsoleAdapter.Holder> {

  public ConsoleAdapter(Context context, List<String> infos) {
    super(context, infos);
  }

  @Override
  protected void bindView(int position, Holder holder, View convertView, String bean) {
    holder.consoleTv.setText(bean);
    if (position==0){
      holder.spaceView.setVisibility(View.VISIBLE);
    }else {
      holder.spaceView.setVisibility(View.GONE);
    }
  }

  @Override
  protected int getLayoutId() {
    return R.layout.custom_view_console_item;
  }

  @Override
  public Holder getHolder(View view) {
    return new Holder(view);
  }

  public class Holder extends BaseViewHolder{
    TextView consoleTv;
    View spaceView;
    public Holder(View itemView) {
      super(itemView);
      spaceView= itemView.findViewById(R.id.space_view);
      consoleTv =itemView.findViewById(R.id.item_console_tv);
    }
  }
}
